package com.group.service.impl;

import com.group.mapper.AnorderMapper;
import com.group.service.AnorderService;
import com.group.user.ChaVo;
import com.group.user.ClientVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Calendar;
import java.util.Date;
import java.util.List;

@Service
public class AnorderServiceImpl implements AnorderService {

    @Autowired
    private AnorderMapper anorderMapper;

    @Override
    public List list() {
        return anorderMapper.list();
    }

    @Override
    public List memberlist(ChaVo chaVo) {
        return anorderMapper.memberlist(chaVo);
    }

    @Override
    public void memberdel(int id) {
        anorderMapper.memberdel(id);
    }

    @Override
    public void memberadd(ClientVo clientVo) {
        Date date = new Date();
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        calendar.add(Calendar.MONTH,1);
        clientVo.setVipStartTime(date);
        clientVo.setVipEndTime(calendar.getTime());
        anorderMapper.memberadd(clientVo);
    }

    @Override
    public ClientVo memberto(int id) {
        return anorderMapper.memberto(id);
    }

    @Override
    public ClientVo memberpass(int id) {
        return anorderMapper.memberpass(id);
    }

    @Override
    public void memberstatus(int id, int status) {
        System.out.println(id+"+"+status);
        anorderMapper.memberstatus(id,status);
    }

    @Override
    public void delAll(String ids) {
        anorderMapper.delAll(ids);
    }


}
